package cn.iocoder.yudao.module.digital.dal.mysql.thesis;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.digital.dal.dataobject.thesis.ThesisDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.digital.controller.admin.thesis.vo.*;

/**
 * 论文 Mapper
 *
 * @author admin
 */
@Mapper
public interface ThesisMapper extends BaseMapperX<ThesisDO> {

    default PageResult<ThesisDO> selectPage(ThesisPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ThesisDO>()
                .eqIfPresent(ThesisDO::getTitle, reqVO.getTitle())
                .betweenIfPresent(ThesisDO::getPostedTime, reqVO.getPostedTime())
                .eqIfPresent(ThesisDO::getPublications, reqVO.getPublications())
                .eqIfPresent(ThesisDO::getAffiliation, reqVO.getAffiliation())
                .eqIfPresent(ThesisDO::getAuthor, reqVO.getAuthor())
                .eqIfPresent(ThesisDO::getEvidenceUrl, reqVO.getEvidenceUrl())
                .eqIfPresent(ThesisDO::getAuthorType, reqVO.getAuthorType())
                .eqIfPresent(ThesisDO::getRate, reqVO.getRate())
                .eqIfPresent(ThesisDO::getType, reqVO.getType())
                .eqIfPresent(ThesisDO::getReserved1, reqVO.getReserved1())
                .eqIfPresent(ThesisDO::getReserved2, reqVO.getReserved2())
                .eqIfPresent(ThesisDO::getReserved3, reqVO.getReserved3())
                .eqIfPresent(ThesisDO::getReserved4, reqVO.getReserved4())
                .eqIfPresent(ThesisDO::getReserved5, reqVO.getReserved5())
                .orderByDesc(ThesisDO::getId));
    }

}